package com.zqx.adapter.adapter;

import com.zqx.adapter.adaptee.PoliceLamp;
import com.zqx.adapter.adaptee.PoliceSound;
import com.zqx.adapter.target.CarController;

/**
 * description: 适配器
 * @author zqx
 * @date 2018/09/02
 */
public class PoliceCarAddapter extends CarController {

    private PoliceLamp policeLamp;//定义适配者PoliceLamp对象
    private PoliceSound policeSound;//定义适配者PoliceSound对象

    public PoliceCarAddapter() {

        policeLamp = new PoliceLamp();
        policeSound = new PoliceSound();
    }

    //发出警笛声
    @Override
    public void phonate() {
        policeSound.alarmSound();
    }

    //呈现警灯闪烁
    @Override
    public void twinkle() {
        policeLamp.alarmLamp();
    }
}
